<?php echo $this->render('frontend_common/header.phtml'); ?>
<?php echo $this->render('frontend_common/left_content.phtml'); ?>
	<?php $detail = $this->giohoadetail;?>
	<div id="detail" style="margin: 50px">
		<div id="leftdetail" style="width: 400px">
			<img src="<?php echo $this->baseUrl("images/".$detail['img_url']);   ?>" />
		</div>
		<div id="rightdetail">
			<table>
				<tr>
					<td><h3><?php echo $detail['tengiohoa']; ?></h3></td>
				</tr>
				<tr>
					<td>Mã sản phẩm : <?php echo $detail['id'];?></td>
				</tr>
				<tr>
					<td>Đơn giá : <?php echo $detail['dongiaban'];?></td>
				</tr>
				<tr>
					<td>Số lượng tồn : <?php echo $detail['slton'];?></td>
				</tr>
				<tr>
					<td>
						<a href="javascript:" class="button cart_button" rel="<?php
										if ($detail['slton']>0) 
											echo $detail['id'];
										else 
											echo -1; 
									 ?>" title="bo hoa vao gio">Đặt mua</a>
					 	<a class="button" href="<?php echo $this->baseUrl('index/index'); ?>">
					 		Về trang chủ
					 	</a>
					</td>
				</tr>
			</table>
		</div>
	</div><!-- End of detail -->
<script type="text/javascript">
	$(document).ready(function(){
		$('.cart_button').click(function(){//Khi nguoi dung click vao class la: cart_button
			var id =$(this).attr('rel');//lay gia tri rel trong cho minh gan class
			//alert('id la: '+id);
			if(id!=-1)
				window.location = "<?php echo $this->baseUrl('/cart/createorder/id_sp/');?>"+id;//di chuyen sang trang khac
			else
				alert('Sản phầm này hiện tại đã hết hàng.Xin vui lòng chọn sản phẩm khác');
		});
	});
</script>
<?php //echo $this->render('frontend_common/rightcontent.phtml'); ?>
<?php echo $this->render('frontend_common/footer.phtml'); ?>